package main

import (
	"dhfshop/service/img/mark"
	"log"
	"os"
)

var (
	//imgPath string = ""
)

func init() {
	imgPath = "./img/"
}

func main() {
	// 输入文件
	src, err := os.Open(imgPath + "src.jpg")
	if err != nil {
		log.Fatalln(err)
	}
	defer src.Close()
    // 水印文件
	water, err := os.Open(imgPath + "water.jpg")
	if err != nil {
		log.Fatalln(err)
	}
	defer water.Close()
	// 结果文件
	dst, err := os.OpenFile(imgPath+"out.jpg", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0666)
	if err != nil {
		log.Fatalln(err)
	}
	defer dst.Close()
    //
	markWriter := mark.NewMark()
	//markWriter.SetStartPoint(5, 10)
	err = markWriter.Mark(src, water, dst, 1)
	if err != nil {
		log.Fatalln(err)
	}
}
